import { createRouter, createWebHashHistory } from 'vue-router';
import Layout from '@/layout/index.vue'

// 静态路由
export const constantRoutes = [
  {
    path: '/',
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: () => import('@/views/import/index.vue'),
        name: 'excel',
        meta: { title: 'excel', icon: 'excel', affix: true }
      },
    //   {
    //     path: '401',
    //     component: () => import('@/views/error-page/401.vue'),
    //     meta: { hidden: true }
    //   }
    ]
  }
];

// 创建路由
const router = createRouter({
  history: createWebHashHistory(),
  routes: constantRoutes,
  // 刷新时，滚动条位置还原
  scrollBehavior: () => ({ left: 0, top: 0 })
});

// 重置路由
// export function resetRouter() {
//   const permissionStore = usePermissionStoreHook();
//   permissionStore.routes.forEach(route => {
//     const name = route.name;
//     if (name && router.hasRoute(name)) {
//       router.removeRoute(name);
//     }
//   });
// }

export default router;
